input {
    &[type='checkbox'] {
        padding: 0;
        width: $--checkbox-size-default;
        height: $--checkbox-size-default;
        border-radius: $--border-radius-small;
    }
}

.foxui-checkbox {
    display: flex;
    align-items: center;
    color: $--color-text-regular;
    font-weight: 500;
    font-size: $--font-size-base;
    position: relative;
    cursor: pointer;
    display: inline-block;
    white-space: nowrap;
    user-select: none;

    .foxui-checkbox-input {
        white-space: nowrap;
        cursor: pointer;
        outline: none;
        display: inline-block;
        line-height: 1;
        position: relative;
        vertical-align: middle;

        .foxui-checkbox-icon {
            display: inline-block;
            position: relative;
            border: $--border-base;
            border-radius: $--border-radius-small;
            box-sizing: border-box;
            width: $--checkbox-size-default;
            height: $--checkbox-size-default;
            background-color: $--color-white;
            z-index: 1;
            transition: $--border-transition-base, background-color $--background-color-transition-base;

            &::after {
                content: '';
                box-sizing: content-box;
                border: 2px $--border-style-base $--color-white;
                border-left: 0;
                border-top: 0;
                height: $--checkbox-size-default / 2;
                left: $--checkbox-size-default / 4;
                position: absolute;
                top: 0;
                transform: rotate(45deg) scaleY(0);
                width: $--checkbox-size-default / 4;
                transition: transform 0.15s ease-in 0.05s;
                transform-origin: center;
            }
        }

        input {
            opacity: 0;
            outline: none;
            position: absolute;
            margin: 0;
            width: 0;
            height: 0;
            z-index: -1;
        }
    }

    .foxui-checkbox-label {
        margin-left: $--padding-extra-small;
    }

    &.is-checked {
        .foxui-checkbox-input {
            .foxui-checkbox-icon {
                background-color: $--color-primary-light-2;
                border-color: $--color-primary-light-2;

                &::after {
                    transform: rotate(45deg) scaleY(1);
                }
            }
        }
    }

    &.is-indeterminate {
        .foxui-checkbox-input {
            .foxui-checkbox-icon {
                background-color: $--color-primary-light-2;
                border-color: $--color-primary-light-2;

                &::before {
                    content: '';
                    position: absolute;
                    display: block;
                    background-color: #fff;
                    height: 2px;
                    transform: scale(0.5);
                    left: 0;
                    right: 0;
                    top: $--checkbox-size-default / 2 - 2;
                }
            }
        }
    }

    &:hover {
        .foxui-checkbox-icon {
            border-color: $--color-primary-light-1;
        }
    }

    & + .foxui-checkbox {
        margin-left: $--padding-large;
    }

    &.is-disabled {
        cursor: not-allowed;

        .foxui-checkbox-input {
            cursor: not-allowed;

            .foxui-checkbox-icon {
                border-color: $--checkbox-disabled-border-color;
                background-color: $--checkbox-disabled-input-fill;
                color: $--checkbox-disabled-icon-color;

                &::after {
                    border-color: $--checkbox-disabled-icon-color;
                }

                &::before {
                    background-color: $--checkbox-disabled-icon-color;
                }
            }
        }

        .foxui-checkbox-label {
            color: $--checkbox-disabled-icon-color;
        }
    }
}
